---
title: "Identifying Price Informativeness"
author: "Eduardo Davila^[Yale] & Cecilia Parlatore^[NYU Stern]"
date: "`r Sys.Date()`"
output:
  html_document: default
  pdf_document: default
---

```{r echo=FALSE, include=FALSE}
 
library(here); library(tidyverse); library(writexl)
path <- here::here(); print(path); setwd(path); rm(path)

```

```{r}

load("intermediate/parameters.RData")
load(paste0("intermediate/results_rolling_clean.RData"))

if (!file.exists("output/csv/")){ 
 dir.create("output/csv/") 
}

rolling_q_clean <- results_q_rolling_clean %>% select(year_start:n_obs, R2_long, R2_short, tau_pi_R)
rolling_q_clean_unlearnable <- results_q_rolling_unlearnable_clean %>% select(year_start:n_obs, R2_long, R2_short, tau_pi_R)
rolling_q_clean_nocon <- results_q_rolling_nocon_clean %>% select(year_start:n_obs, R2_long, R2_short, tau_pi_R)

write_xlsx(rolling_q_clean, paste0("output/csv/rolling_q.xlsx"))
write_xlsx(rolling_q_clean_unlearnable, paste0("output/csv/rolling_q_unlearnable.xlsx"))
write_xlsx(rolling_q_clean_nocon, paste0("output/csv/rolling_q_nocontrols.xlsx"))


load("intermediate/results_PS.RData")

q_PS <- results_q_PS %>% select(permno, year_end, month_end, tau_pi_R)
q_PS_unlearnable <- results_q_PS_unlearnable %>% select(permno, year_end, month_end, tau_pi_R)
q_PS_nocon <- results_q_PS_nocon %>% select(permno, year_end, month_end, tau_pi_R)

write_xlsx(q_PS, paste0("output/csv/q_PS.xlsx"))
write_xlsx(q_PS_unlearnable, paste0("output/csv/q_PS_unlearnable.xlsx"))
write_xlsx(q_PS_nocon, paste0("output/csv/q_PS_nocon.xlsx"))


```

